import { ref, reactive } from "vue"

const currentLang = ref("zh")

const translations = reactive({
  zh: {
    // 导航
    home: "首页",
    products: "产品",
    aiAssistant: "AI助手",
    contact: "联系我们",
    backToHome: "返回首页",

    // 首页
    heroTitle: "专业电器设备解决方案",
    heroSubtitle: "为您提供最先进的电器设备，结合AI智能推荐，打造完美的用户体验",
    exploreProducts: "探索产品",
    featuredProducts: "精选产品",

    // 产品
    smartHomeSystem: "智能家居系统",
    smartHomeDesc: "全套智能家居解决方案，让您的生活更加便捷舒适",
    industrialAutomation: "工业自动化设备",
    industrialDesc: "高效可靠的工业自动化解决方案，提升生产效率",
    medicalElectronics: "医疗电子设备",
    medicalDesc: "精密医疗电子设备，为健康保驾护航",
    securitySystem: "安防监控系统",
    securityDesc: "先进的安防监控解决方案，保障您的安全",

    // AI助手
    aiSmartAssistant: "AI智能助手",
    aiDescription: "基于DeepSeek AI技术，为您提供专业的产品咨询和推荐服务",
    enterQuestion: "请输入您的问题...",
    askAI: "咨询AI",

    // 联系信息
    contactInfo: "联系信息",
    productCategories: "产品分类",
    support: "服务支持",
    allRightsReserved: "版权所有",

    // 按钮
    buyNow: "立即购买",
    scheduleDemo: "预约演示",
    technicalConsultation: "技术咨询",
    getQuote: "获取报价",
    freeConsultation: "免费咨询",

    // 产品详情
    productHighlights: "产品亮点",
    systemComponents: "系统组成",
    wholeHouseControl: "全屋智能控制",
    voiceControl: "语音识别控制",
    mobileAppControl: "手机APP远程操作",
    energySaving: "节能环保设计",
    securityProtection: "安全防护系统",
    smartLighting: "智能照明系统",
    temperatureControl: "温控调节系统",
    securityMonitoring: "安防监控系统",
    backgroundMusic: "背景音乐系统",
    networkHub: "智能网络中枢",
    mobileControl: "移动控制",
    mobileControlDesc: "随时随地通过手机APP控制家中所有智能设备",
    voiceControlDesc: "支持中英文语音识别，解放双手的智能体验",
    timerControl: "定时控制",
    timerControlDesc: "智能定时功能，让生活更有规律和节能",
    aiLearning: "AI学习",
    aiLearningDesc: "系统自动学习用户习惯，提供个性化服务",
    experienceSmartLiving: "立即体验智能生活",
    professionalInstallation: "专业团队提供上门安装服务，一年质保，终身技术支持",
  },
  en: {
    // Navigation
    home: "Home",
    products: "Products",
    aiAssistant: "AI Assistant",
    contact: "Contact",
    backToHome: "Back to Home",

    // Home
    heroTitle: "Professional Electronics Solutions",
    heroSubtitle: "Providing cutting-edge electronics with AI-powered recommendations for the perfect user experience",
    exploreProducts: "Explore Products",
    featuredProducts: "Featured Products",

    // Products
    smartHomeSystem: "Smart Home System",
    smartHomeDesc: "Complete smart home solution for convenient and comfortable living",
    industrialAutomation: "Industrial Automation",
    industrialDesc: "Efficient and reliable industrial automation solutions to boost productivity",
    medicalElectronics: "Medical Electronics",
    medicalDesc: "Precision medical electronics for health protection",
    securitySystem: "Security System",
    securityDesc: "Advanced security monitoring solutions for your safety",

    // AI Assistant
    aiSmartAssistant: "AI Smart Assistant",
    aiDescription: "Powered by DeepSeek AI technology, providing professional product consultation and recommendations",
    enterQuestion: "Enter your question...",
    askAI: "Ask AI",

    // Contact
    contactInfo: "Contact Info",
    productCategories: "Product Categories",
    support: "Support",
    allRightsReserved: "All rights reserved",

    // Buttons
    buyNow: "Buy Now",
    scheduleDemo: "Schedule Demo",
    technicalConsultation: "Technical Consultation",
    getQuote: "Get Quote",
    freeConsultation: "Free Consultation",

    // Product Details
    productHighlights: "Product Highlights",
    systemComponents: "System Components",
    wholeHouseControl: "Whole house intelligent control",
    voiceControl: "Voice recognition control",
    mobileAppControl: "Mobile APP remote control",
    energySaving: "Energy-saving eco design",
    securityProtection: "Security protection system",
    smartLighting: "Smart lighting system",
    temperatureControl: "Temperature control system",
    securityMonitoring: "Security monitoring system",
    backgroundMusic: "Background music system",
    networkHub: "Smart network hub",
    mobileControl: "Mobile Control",
    mobileControlDesc: "Control all smart devices at home anytime via mobile APP",
    voiceControlDesc: "Supports Chinese and English voice recognition for hands-free experience",
    timerControl: "Timer Control",
    timerControlDesc: "Smart timer function for more regular and energy-efficient living",
    aiLearning: "AI Learning",
    aiLearningDesc: "System automatically learns user habits to provide personalized services",
    experienceSmartLiving: "Experience Smart Living Now",
    professionalInstallation:
      "Professional team provides door-to-door installation, one-year warranty, lifetime technical support",
  },
})

export function useI18n() {
  const t = (key) => {
    return translations[currentLang.value][key] || key
  }

  const toggleLanguage = () => {
    currentLang.value = currentLang.value === "zh" ? "en" : "zh"
  }

  const getCurrentLang = () => currentLang.value

  return {
    t,
    toggleLanguage,
    getCurrentLang,
    currentLang,
  }
}
